﻿using System.Collections.Generic;
using Bdcs.Application.Mappers.Dto;
using Bdcs.Application.Services.IServices;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;

namespace Bdcs.Application.Controllers
{
    [ApiDescriptionSettings("用户权限接口@101")]
    public class UserAuthController : IDynamicApiController
    {

        private readonly IUserAuthService _authService;

        public UserAuthController(IUserAuthService authService)
        {
            _authService = authService;
        }

        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <returns></returns>
        public List<UserAuthDto> List(string userId)
        {
            return _authService.List(userId);
        }

        /// <summary>
        /// 保存用户权限
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <param name="auths">用户对应的权限</param>
        /// <returns>影响行数</returns>
        public int Save(string userId,string auths)
        {
            return _authService.SaveUserAuth(userId,auths);
        }
    }
}